<template>
	<view class="content">
		<u-navbar back-text="" title="">
			<view style="width: 100%;display: flex;justify-content: center;font-weight: bold;font-size: 34rpx;">
				黑名单
			</view>
			<view slot="right">
				<view style="margin-right: 50rpx;">
					
				</view>
			</view>
		</u-navbar>
		
		<scroll-view v-if="list.length > 0" style="width: 100%;flex: 1;overflow-y: auto;flex-direction: column;" scroll-y >
			<view @click="refriend(itemx)" v-for="(itemx, index) in list" :key="index" style="width: 100%;padding: 20rpx;background: white;border-bottom: 1rpx solid #ececec;display: flex;justify-content: space-between;align-items: center;">
				<view style="display: flex;align-items: center;">
					<u-avatar mode="square" size="80" :src="$store.state.common.systemInfo.fileurl + 'avatar/' + itemx.fid + '.jpg'"></u-avatar>
					<view style="margin-left: 10rpx;display: flex;flex-direction: column;justify-content: center;">
						<view style="font-size: 30rpx;">
							{{itemx.name}}
						</view>
						<view v-if="itemx.note" style="color: #a6a6a6;font-size: 24rpx;">
							{{itemx.note}}
						</view>
					</view>
				</view>
				<view class="">
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
			
		</scroll-view>
		
		<view v-else style="width: 100%;display: flex;justify-content: center;align-items: center;flex: 1;">
			<u-empty></u-empty>
		</view>
		
		<u-action-sheet @click="removehmd" :list="listhd" v-model="show"></u-action-sheet>
		
	</view>

	
</template>

<script>
	import {
		mapState
	} from 'vuex';
	import {
		pub
	} from '../../common/event';
	export default {
		data() {
			return {
				show:false,
				current:{},
				listhd:[{
					text:"移除黑名单"
				}]
			}
		},
		components: {

		},
		computed: {
			...mapState({
				list: (state) => {
					return state.friend.list.filter(e=>{
						return e.status == '拉黑'
					})
				}
			})
		},

		onLoad() {
			this.getdata()
		},
		methods: {
			getdata:function(){},
			refriend:function(e){
				this.current = e
				this.show = true
			},
			removehmd:async function(e){
				console.log(e)
				if(e == 0){
					const user = this.$store.state.user.user
					const ret = await this.$u.put(`friend/friend/remhmd`, {
						fid: this.current.fid,
						uid: user.id
					})
					this.$store.commit(`friend/remhmd`, {
						fid: this.current.fid,
						uid: user.id
					})
					uni.switchTab({
						url: "/pages/friend/index"
					})
				}
			},
		}
	}
</script>


<style scoped>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 100%;
		height: 100vh;
		overflow-y: hidden;
		padding-bottom: 120rpx;
		border-start-end-radius: 32rpx;
		border-start-start-radius: 32rpx;
	}
</style>